package com.edu.exam.entity.personnel.student;

import jakarta.persistence.*;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.Size;
import java.time.LocalDateTime;

/**
 * 学籍异动审批记录实体类
 * [所属模块] F-04 学籍管理模块
 * 对应数据库表：enrollment_change_approval */
@Entity
@Table(name = "enrollment_change_approval")
public class EnrollmentChangeApproval {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @NotNull(message = "异动申请ID不能为空")
    @Column(name = "change_id", nullable = false)
    private Long changeId;

    @NotNull(message = "审批层级不能为空")
    @Min(value = 1, message = "审批层级必须大于0")
    @Column(name = "approval_level", nullable = false)
    private Integer approvalLevel;

    @NotBlank(message = "审批人不能为空")
    @Size(max = 100, message = "审批人长度不能超过100个字符")
    @Column(name = "approver", nullable = false, length = 100)
    private String approver;

    @NotBlank(message = "审批人角色不能为空")
    @Size(max = 50, message = "审批人角色长度不能超过50个字符")
    @Column(name = "approver_role", nullable = false, length = 50)
    private String approverRole;

    @NotNull(message = "审批决定不能为空")
    @Column(name = "decision", nullable = false, length = 20)
    private String decision; // TODO: 迁移到外部枚举 ApprovalDecision

    @Size(max = 1000, message = "审批意见长度不能超过1000个字符")
    @Column(name = "comments", length = 1000)
    private String comments;

    @Size(max = 1000, message = "拒绝原因长度不能超过1000个字符")
    @Column(name = "rejection_reason", length = 1000)
    private String rejectionReason;

    @NotNull(message = "审批时间不能为空")
    @Column(name = "approval_time", nullable = false)
    private LocalDateTime approvalTime;

    @Column(name = "created_time", nullable = false, updatable = false)
    private LocalDateTime createdTime;

    @Size(max = 50, message = "创建人长度不能超过50个字符")
    @Column(name = "created_by", length = 50)
    private String createdBy;

    }